ENH Add support for reinstalling packages#64
Conversation
|
Yes, there is a sprint in PyConUS so I tagged a few issues people have more to choose from. No worries if you took it :) |
|
Thanks @ryanking13!
I don't think this makes sense as a default. In my opinion it should not reinstall anything unless it is specifically requested. |
Maybe my description was not clear. It uninstalls only if the requested version is incompatible with the installed version. Previously in such cases, micropip failed with: |
hoodmane
left a comment
There was a problem hiding this comment.
I still think failing is better by default than reinstall. I think people really mostly don't want to reinstall packages that they've already imported but they might not realize they don't want to. Maybe having an allow reinstall flag would be good.
At the wasm summit they were asking if they could test packaging against wasm and I was like sure easy but then the command line runner had some weird crash...
Yeah, I'm also not sure about it. As a user, in the example above I would expect the If we take the case where we install some packages. Some are already installed with different versions. If the version is compatible we do nothing, if it isn't we uninstall them, and install the requested version (and leave all other packages unchanged). That's more or less what pip does (or used to do) by default. Can't we do that? |
Hmm, yes. Unlike other package managers micropip is a runtime package manager so the situation is more complex that some packages might be already imported... and we don't show any logs (unless verbose option is enabled in #60), so people will not even notice that some packages are reinstalled.
Yes, that is the current expected bahavior but I guess Hood does not prefer uninstalling packages without an explicit flag? |
|
Then how about:
|
Well if it's for matching pip then I could sort of see it. But the issue is just what happens if the package is already imported... |
Well jupyter shares the same problem and users would need to call |
|
Closing in favor of #206 |
Resolve #51
This PR changesmicropip.installbehavior to remove previously installed packages and reinstall the new version. In addition, it adds theforce_reinstallparameter tomicropip.install, allowing it to force a reinstall even if it already meets the requirements.Edit:
This PR adds
reinstallparameter to micropip.install which allows reinstalling packages that are already installed.